PV-on-HVM: Include compatibility kzalloc implementation for kernels
authorIan Campbell <ian.campbell@xensource.com>
Wed, 25 Oct 2006 12:58:30 +0000 (13:58 +0100)
committerIan Campbell <ian.campbell@xensource.com>
Wed, 25 Oct 2006 12:58:30 +0000 (13:58 +0100)
before 2.6.14.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com>
Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@jp.fujitsu.com>
unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
unmodified_drivers/linux-2.6/platform-pci/platform-compat.c

index 6c08dad47d45a5b3500756675ea0b28ef2e03825..219382c3c1510ac2db5eb8e2dea25758fe57bade 100644 (file)
@@ -41,4 +41,8 @@ unsigned long wait_for_completion_timeout(struct completion *x, unsigned long ti
 signed long schedule_timeout_interruptible(signed long timeout);
 #endif
 
+#if defined(_LINUX_SLAB_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+void *kzalloc(size_t size, int flags);
+#endif
+
 #endif
index f7c8db7fcd3b9051173ab751a2029cfb0dd62e14..f3cef116204e658e308288a1908b1b101f99d45e 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/slab.h>
 
 #include <xen/platform-compat.h>
 
@@ -97,3 +98,19 @@ signed long schedule_timeout_interruptible(signed long timeout)
 }
 EXPORT_SYMBOL(schedule_timeout_interruptible);
 #endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+/**
+ * kzalloc - allocate memory. The memory is set to zero.
+ * @size: how many bytes of memory are required.
+ * @flags: the type of memory to allocate.
+ */
+void *kzalloc(size_t size, int flags)
+{
+       void *ret = kmalloc(size, flags);
+       if (ret)
+               memset(ret, 0, size);
+       return ret;
+}
+EXPORT_SYMBOL(kzalloc);
+#endif